<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>中国福利彩票</title>
<link href="css/style.css" type="text/css" rel="stylesheet" />
	<link rel="icon" href="images/favicon.png" type="image/x-icon"/>
<script src="js/jquery-1.7.2.min.js"></script>

<!--两个省级联动-->
<script language="javascript" src="js/PCASClass.js"></script>


</head>

<body>
	<div class="Header">
    	<div class="width1200">
        	<div class="left H_logo"><img src="images/logo.png" width="200" /></div>
            <div class="right H_right">  <a href="Login.html">登录</a> <a href="Xzjls.html">跳过</a> </div>
            <div class="clear"></div>
        </div>
    </div>
	
    <div class="width1200">
    	<div class="Register" style="height: 758px;">
        	
            <div class="REG_stpe"><img src="images/Zimg3.png" width="503" /></div>
            
            <div class="REG_Stwo">
            	<table width="100%" border="5" cellspacing="15" cellpadding="0">
                  <tr>
                    <td width="20%" align="right">邮箱</td>
                    <td width="80%"><input type="text" class="RE1_t3" id="email"/>
                    </td>
                  </tr>
                  <tr>
                    <td align="right">职业</td>
                    <td>
                    	<select name="" class="RE1_sex1" style="width:260px" id="job">
                    	  <option value="1">专业技术人员（律师，工程师等）</option>
                    	  <option value="2">政府公务员或事业单位编制人员</option>
                    	  <option value="3">个体户/私营老板</option>
                    	  <option value="4">企业中高层管理人员</option>
                    	  <option value="5">企业办公室职员</option>
                    	  <option value="6">工人，服务人员等</option>
<!--                     	  <option value="7">自由职业者</option> -->
<!--                     	  <option value="8">其他</option> -->
                    	</select>
                    </td>
                  </tr>
                  <tr>
                    <td align="right">月收入</td>
                    <td>
                    	<select name="" class="RE1_sex1" id="monthincome">
                    	  <option value="1">1000元以下</option>
                    	  <option value="2">1000-3000元</option>
                    	  <option value="3">3000-5000元</option>
                    	  <option value="4">5000-10000元</option>
                    	  <option value="5">10000-20000元</option>
                    	  <option value="6">20000元以上</option>
                    	</select>
                    </td>
                  </tr>
                  <tr>
                    <td align="right">学历</td>
                    <td>
                    	<select name="" class="RE1_sex1" style="width:200px;" id="education">
                    	  <option value="1">高中/中专/中技及以下</option>
                    	  <option value="2">大专及同等学历</option>
                    	  <option value="3">本科/学士及同等学历</option>
                    	  <option value="4">硕士/研究生及同等学历</option>
                    	  <option value="5">博士及以上</option>
                    	</select>
                    </td>
                  </tr>
                  <tr>
                    <td align="right">地址</td>
                    <td>
                    	<div class="SB_city">
                        	<select name="province" id="province"></select>
                        	<select name="city" id="city"></select>
                        	<input type="text" style="border:1px solid #b2b2b2;height:33px;margin-top:10px;width:260px;" placeholder="请输入具体街道"  id="address" name="address">
                        </div>
                    </td>
                  </tr>
                  <tr>
                    <td align="right" valign="top">身份证正面</td>
                    <td>
                    	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table1">
                          <tr>
                            <td width="30%">
                           	  <div class="RE_c">
                                	<a href="JavaScript:void(0)" onclick="selPic('idCardPhotoFront')">
                                    	<img src="images/s.png" width="96" id="idCardPhotoFront"/>
                                	</a>
                           	  </div>
                            </td>
                            <td width="33%" align="center" valign="top">身份证背面</td>
                            <td width="37%">
                            	<div class="RE_c">
                                	<a href="JavaScript:void(0)"  onclick="selPic('idCardPhotoBehind')">
                                    	<img src="images/s.png" width="96" id="idCardPhotoBehind"/>
                                	</a>
                            	</div>
                            </td>
                            <td style="display: none;">
                            <input type="file" name="file" id="docFront" style="width:150px;" onchange="setImagePreview('','docFront','idCardPhotoFront')">
                            <input type="file" name="file" id="docBehind" style="width:150px;" onchange="setImagePreview('','docBehind','idCardPhotoBehind')">
                           	<input type="text"  id="idCardPhotoFrontCode"/>
                           	<input type="text"  id="idCardPhotoBehindCode"/>
                            </td>
                          </tr>
                        </table>
                    </td>
                  </tr>
                  <tr>
                    <td align="right">&nbsp;</td>
                    <td>
                    	<input type="submit" value="完成" class="RS_go"  onclick="nextStep()" />
                    </td>
                  </tr>
                </table>
            </div>
            
        </div>
    </div>
    
    <div class="Footer">
    	<div class="width1200">
        	<div class="left">版权所有：中国福利彩票发行管理中心    网站主办：中国福利彩票发行管理中心</div>
            <div class="right"><img src="images/Flogo.png" width="110" /></div>
            <div class="clear"></div>
        </div>
    </div>
    
</body>
<script type="text/javascript">
	var accountId="";
	var token="";
	var channelId="";
    jQuery(document).ready(function($){
    	accountId = getCookie("accountId");
    	token =  getCookie("token");
    	channelId = getCookie("channelId");
    	//调用地区参数查询接口
    	getFirstLevel();
    	getSecondLevel($('#province').val());
    	
    	//归属地第一级改变出发的事件
    	$("#province").change(function(){
    		getSecondLevel($('#province').val());
    		});
    });
    function selPic(id){
    	if(id=='idCardPhotoBehind'){
    		document.getElementById("docBehind").click();
    	}else{ 
    		document.getElementById("docFront").click();
    	}
    	
    }
    //点击完成
    function nextStep(){
    	 //验证邮箱
    	if(!validateEmail('email')){
    		return;
    	}
    	 //验证身份证
    	if(!validateIdPhoto('idCardPhotoFront','idCardPhotoBehind')){
    		return;
    	}
    	  var para = {
    			  	accountId:accountId,
					token:token,
					email:$('#email').val(),
    				job:$('#job').val(),
    				monthincome:$('#monthincome').val(),
    				education:$('#education').val(),
    				address:$('#province').val()+"_"+$('#city').val()+"_"+$('#address').val(),
    				idCardPhotoFront:$('#idCardPhotoFrontCode').val(),
    				idCardPhotoBehind:$('#idCardPhotoBehindCode').val(),
    				channelId:channelId
    	        };
    		
    		$.ajax({
    			url : "../../api/CrmSystem/register/complement",
    			async:false,
    			type : "POST",
    			herder:{
    				'Accept':'application/json',
    				'Content-Type':'application/json'
    			},
    			dataType:"json",
    			contentType:"application/json",
    			data: JSON.stringify(para),
    			error:function(XMLHttpRequest, textStatus, errorThrown){
    				alert(errorThrown);
    			},
    			success: function(data, textStatus){
    				if(data.success == true){
    					window.location.href='Xzjls.html';
    				}else{
    					alert("error:"+data.description);
    					return;
    				}
    			}		
    		});
    }
    //获得归属地--第一级
    function getFirstLevel(){
    	$.ajax({
    		url : "../../api/CrmSystem/para/region?pid=0",
    		async:false,
    		type : "GET",
    		herder:{
    			'Accept':'application/json',
    			'Content-Type':'application/json'
    		},
    		dataType:"json",
    		contentType:"application/json",
    		error:function(XMLHttpRequest, textStatus, errorThrown){
    			alert(errorThrown);
    		},
    		success: function(data, textStatus){
    			document.getElementById("province").options.length=0;
//     			var obj = eval("("+data+")"); 
    			for(var i=0;i<data.length;i++){
    				document.getElementById("province").options.add(new Option(data[i].regionName,data[i].id));
    			}
    		}		
    	});
    }
    //获得归属地--第二级
    function getSecondLevel(pid){
    	if(pid==null){
    		pid=0;
    	}
    	$.ajax({
    		url : "../../api/CrmSystem/para/region?pid="+pid+"",
    		async:false,
    		type : "GET",
    		herder:{
    			'Accept':'application/json',
    			'Content-Type':'application/json'
    		},
    		dataType:"json",
    		contentType:"application/json",
    		error:function(XMLHttpRequest, textStatus, errorThrown){
    			alert(errorThrown);
    		},
    		success: function(data, textStatus){
    			document.getElementById("city").options.length=0;
//     			var obj = eval("("+data+")"); 
    			for(var i=0;i<data.length;i++){
    				document.getElementById("city").options.add(new Option(data[i].regionName,data[i].id));
    			}
    		}		
    	});
    }
</script>  
<!-- <script language="javascript" defer> 
	new PCAS("province","city","area","北京市","北京市","北京市");
 </script> -->
<script src="js/common.js"></script>
<script src="js/jsCallCookies.js"></script>
<script src="js/validation.js"></script>
</html>
